/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tpdisenio2009.model.dao;

import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import tpdisenio2009.model.HibernateUtils;
import tpdisenio2009.model.beans.RealTeam;

/**
 *
 * @author Pablito
 */
public class RealTeamDAO extends AbstractDAO<RealTeam> {

    @Override
    public Class<RealTeam> getPersistentClass() {
        return RealTeam.class;
    }

    public List<RealTeam> getRealTeamsByName ( String name ) {
        Session session = HibernateUtils.getCurrentSession();

        Criteria mainCriteria = session.createCriteria( RealTeam.class );
        mainCriteria.add( Restrictions.eq( "name", name ) );

        return mainCriteria.list();
    }
}
